<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of BServiceApp
 *
 * @author ID59C
 */
class BServiceAppConfig {

    //put your code here
    private $sApp = null;
    public $basePath = null;
    public $viewPath = null;
    public $formPath = null;
    public $classPath = null;
    public $configPath = null;
    public $dataPath = null;
    public $modelPath = null;
    public $screenPath = null;
    public $screenFlowPath = null;
    public $widgetPath = null;
    public $uiPath = null;

    public function __construct($sApp) {
        $this->sApp = $sApp;

        //by default, set app basePath to app folder
        if ($this->basePath == NULL)
            $this->basePath = "application.application.app." . get_class($sApp);

        if ($this->uiPath == NULL)
            $this->uiPath = $this->basePath . '.ui';

        if ($this->viewPath == NULL)
            $this->viewPath = $this->uiPath . "." . Blyn::app()->getAppUI()->getTheme() . '.views';

        if ($this->formPath == NULL)
            $this->formPath = $this->uiPath . "." . Blyn::app()->getAppUI()->getTheme() . '.forms';

        if ($this->classPath == NULL)
            $this->classPath = $this->basePath . '.classes';

        if ($this->configPath == NULL)
            $this->configPath = $this->basePath . '.config';

        if ($this->dataPath == NULL)
            $this->dataPath = $this->basePath . '.data';

        if ($this->modelPath == NULL)
            $this->modelPath = $this->basePath . '.models';

        if ($this->screenPath == NULL)
            $this->screenPath = $this->basePath . '.screens';

        if ($this->screenFlowPath == NULL)
            $this->screenFlowPath = $this->basePath . '.screenflows';

        if ($this->widgetPath == NULL)
            $this->widgetPath = $this->basePath . '.widgets';
    }
    
    public function initImport()
    {
        yii::import($this->basePath.'.*');
        yii::import($this->uiPath.'.*');
        //yii::import($this->viewPath);
        yii::import($this->formPath.'.*');
        yii::import($this->classPath.'.*');
        yii::import($this->configPath.'.*');
        yii::import($this->modelPath.'.*');
        yii::import($this->screenPath.'.*');
        yii::import($this->screenFlowPath.'.*');
        yii::import($this->widgetPath.'.*');      
        yii::import($this->dataPath.'.*');     
    }

}

?>
